package cn.wolfcode.p2p.website.controller;

import cn.wolfcode.p2p.business.domain.BidRequest;
import cn.wolfcode.p2p.business.service.IBidRequestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

@Controller
public class MainController {
    @Autowired
    private IBidRequestService bidRequestService;

    @RequestMapping("/main")
    public String mainPage(Model model){
        //publishPendngBidRequests 待发标
        List<BidRequest> publishPendngBidRequests = bidRequestService.queryPublishPendngBidRequests();
        model.addAttribute("publishPendngBidRequests", publishPendngBidRequests);
        //bidRequests 发标列表
        model.addAttribute("bidRequests", bidRequestService.queryMainData());
        return "main";
    }
}
